import React, { Component } from 'react';
import ReactDOM from 'react-dom';
// import { Router, Route, Link, Switch } from 'react-router';
import { HashRouter, Route, Link, Switch } from 'react-router-dom';

import './index.css';

import APPMENU from '../src/common/menu.js'
import Home from '../src/apply/reg.js';
import applyLogin from '../src/apply/login.js';
import applyLoginIden from '../src/apply/loginIden.js';
import applyForm from '../src/apply/form.js';
import applyList from '../src/apply/list.js';
import applyDetail from '../src/apply/detail.js';
import companyReg from '../src/company/reg.js';
import companyLogin from '../src/company/login.js';
import companyLoginIden from '../src/company/loginIden.js';
import companyList from '../src/company/list.js';
import companyTakeList from '../src/company/takeList.js';
import companyDetail from '../src/company/detail.js';
import companyClient from '../src/company/client.js';

class App extends Component {
  render() {
    return (
      <div>
        <APPMENU />
        {this.props.children}
      </div>
    );
  }
}

const Message = ({ match }) => (
  <div>
    <h3>new messages</h3>
    <h3>{match.params.id}</h3>
  </div>
)

const Inbox = ({ match }) => (
  <div>
    <h2>Topics</h2>
    <Route path={`${match.url}/messages/:id`} component={Message}/>
  </div>
)

ReactDOM.render(
  (<HashRouter>
    <App>
        <Route exact path="/" component={Home} />
        <Route path="/applyLogin" component={applyLogin} />
        <Route path="/applyLoginIden" component={applyLoginIden} />
        <Route path="/applyForm" component={applyForm} />
        <Route path="/applyList" component={applyList} />
        <Route path="/applyDetail" component={applyDetail} />
        <Route path="/companyReg" component={companyReg} />
        <Route path="/companyLogin" component={companyLogin} />
        <Route path="/companyLoginIden" component={companyLoginIden} />
        <Route path="/companyList" component={companyList} />
        <Route path="/companyTakeList" component={companyTakeList} />
        <Route path="/companyDetail" component={companyDetail} />
        <Route path="/companyClient" component={companyClient} />
    </App>
  </HashRouter>),
  document.getElementById('root')
);
